package com.example.actordemo4.config;

import akka.actor.ActorSystem;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ActorConfig {

    @Autowired
    private ApplicationContext applicationContext;

    @Autowired
    private  SpringExtension springExtension;


    @Bean
    public ActorSystem actorSystem(){
        ActorSystem actorSystem = ActorSystem.create("dc_actor2",akkaConfiguration());
        springExtension.setApplicationContext(applicationContext);
        return  actorSystem;
    }

    @Bean
    public Config akkaConfiguration() {
        Config config = null;

        return ConfigFactory.load();
    }
}
